<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="com.roadmap.common.RdcResourceBundle" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/> 
<link href="res/css/layout.css" rel="stylesheet" type="text/css" media="all" />
<link href="res/css/sns.css" rel="stylesheet" type="text/css" media="all" />
<link href="res/css/widget.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="res/js/func.js"></script>
<script type="text/javascript" src="res/js/widget.js"></script>
<title>找好友 | <%=RdcResourceBundle.COMPANY_NAME %></title>

</head>

<body>
	<jsp:include page="/admin/myheader.jsp"></jsp:include>
	
	<!-- define the frame for logging on-->
	<div class="mainbody"><div class="manager">
	<jsp:include page="/admin/sns/nav_btns.jsp"/>
	
	<!-- middle part: content -->
	<div class="middle-part">
		<div class="section">
			<div class="title-sp">查找好友</div>
		</div>
		
		<div class="section">
			<span class="prompt-message">注意，当前用户不会出现在查询结果里</span>
			<table class="search">
				<tr><th class="head" colspan="2">按姓名查找</th></tr>
				<tr><td class="name">姓名：</td><td class="value"><input id="username" type="text" class="input-text" maxlength="30" /></td></tr>
				<tr><td class="name">性别：</td><td class="value"><select id="sex" class="select"><option value="0">全部</option><option value="m">男</option><option value="f">女</option></select></td></tr>
				<tr><td class="name"></td><td class="value"><input type="button" class="confirmBtn" value="查找" onclick="searchByName();"/></td></tr>
			</table>
			
			<table class="search">
				<tr><th class="head" colspan="2">按注册帐号查找</th></tr>
				<tr><td class="name">注册邮箱：</td><td class="value"><input id="mail" type="text" class="input-text" maxlength="50" /></td></tr>
				<tr><td class="name"></td><td class="value"><input type="button" class="confirmBtn" value="查找" onclick="searchByMail();"/></td></tr>
			</table>
		</div>
	</div>
	
	<!-- right part: -->
	<div class="right-part">
	</div>
	
	</div>
	
	<div class="clear-div"></div>
	</div>
	
	<jsp:include page="/res/jsp/footer.jsp"></jsp:include>

<script type="text/javascript">
	
	function searchByName(){
		var name = $("username").value;
		if(!RDC.util.verifyText(name, 1, 30)){
			PromptDialog.show("姓名不能为空，且长度是1~30");
			return;
		}
		
		var sex = $("sex").value;
		window.location.href = "searchFriends.do?act=byUser&username=" + name + "&sex=" + sex;
	}
	
	function searchByMail(){
		var mail = $("mail").value;
		if(RDC.util.verifyMail(mail)){
			window.location.href = "searchFriends.do?act=byMail&mail=" + mail;
		}
		else {
			PromptDialog.show("您输入的邮箱地址不合法");
		}
	}
</script>

</body>

</html>
